#include "ModelFileInfo.h"
#include <string>

using namespace std;

int readSkelFile( char* filename, Model* skel );

void ModelFileInfo::draw(int _frame, bool _default)
{
	mModel->draw(mColor, !_default);
}

bool ModelFileInfo::loadFile( char* _fName )
{
	if( mModel )
		delete mModel;
	mModel = new Model;
	if( !readSkelFile( _fName, mModel) ){
		string text = _fName;
		int lastSlash = text.find_last_of("/");
		string file = text.substr(lastSlash+1);
		string dir = text.substr(0, lastSlash);
		setFileName(file.c_str());
		setFilePath(dir.c_str());
		return true;
	}
	return false;
}
